package com.woniuxy.oldmanapi.service;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.woniuxy.oldmanapi.entity.OlderBp;
import com.woniuxy.oldmanapi.mapper.OlderBpMapper;
import com.woniuxy.oldmanapi.vo.BpVo;
import com.woniuxy.oldmanapi.vo.HeightVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class BpService {

    @Autowired
    OlderBpMapper olderBpMapper ;

    public PageInfo<BpVo> findBpByPage(Integer now, Integer size, String name) {
        PageHelper.startPage(now,size);
        List<BpVo> BpVoList =  olderBpMapper.selectBpByName(name);
        return new PageInfo<>(BpVoList);
    }

    public void add(OlderBp olderBp) {
        olderBpMapper.insert(olderBp);
    }

    public void delete(int id) {
        olderBpMapper.deleteByPrimaryKey(id);
    }

    public void modify(OlderBp olderBp) {
        olderBpMapper.updateByPrimaryKey(olderBp);
    }
    public BpVo selectOne(int id) {
        return olderBpMapper.selectOneByName(id);
    }
}
